<?php
namespace BWL\webshopBundle\Controller;
/**
 * Created by JetBrains PhpStorm.
 * User: leon
 * Date: 11/7/12
 * Time: 9:41 AM
 * To change this template use File | Settings | File Templates.
 */
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
use JMS\SecurityExtraBundle\Annotation\Secure;


class SecurityController extends Controller
{
  public function loginAction()
  {
    if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
      $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
    } else {
      $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
    }

    return $this->render('BWLwebshopBundle:Security:loginfailed.html.twig', array(
      'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
      'error' => $error
    ));
  }
}
